-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save mappings to options hash when calculated #18194
Save mappings to options hash when calculated #18194
Conversation
:weight => disk.size.to_f / source.allocated_disk_storage.to_f * 100 | ||
} | ||
options[:virtv2v_disks] ||= calculate_virtv2v_disks.tap do |disks| | ||
update_attributes(:options => options.merge(:virtv2v_disks => disks)) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just
return options[:virtv2v_disks] if options[:virtv2v_disks].present?
options[:virtv2v_disks] = calculate_virtv2v_disks
save!
options[:virtv2v_disks]
Checked commits fabiendupont/manageiq@b823e91~...2698585 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@jameswnl PTAL |
Looks ok to me. Just not sure if breaking into 2 new methods is doing any good |
end | ||
return options[:virtv2v_disks] if options[:virtv2v_disks].present? | ||
|
||
options[:virtv2v_disks] = calculate_virtv2v_disks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you would need to do self.options[...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually no need. the reference is unambiguous enough to hitting the record's attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…rst_call Save mappings to options hash when calculated (cherry picked from commit 3b7f61a) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1649020
Hammer backport details:
|
When calculating the network mappings and virtv2v disks, we add them to the task options hash for future consumption, such as when building the virt-v2v-wrapper options. This PR effectively save the options hash, when previous code only changed the in-memory value.
Associated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1649020